import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import org.softmed.rest.admin.file.FileBrowser;
import org.softmed.rest.admin.file.FileManagerProxy;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		final FileBrowser browser = new FileBrowser("test.txt");
		browser.setFileManager(new FileManagerProxy());
		JFrame frame = new JFrame();
		frame.setResizable(false);
		frame.getContentPane().add(browser);
		frame.pack();
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		frame.setVisible(true);

		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent we) {
				try {
					browser.saveRootDirectory();
				} catch (Throwable e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				System.exit(0);

			}
		});

	}

}
